﻿CREATE PROCEDURE dbo.GetMediaDefinitionAudits
@MediaDefinitionId INT
AS
BEGIN

	SELECT
	MediaDefinitionAuditId, MediaDefinitionId, UserId, AuditType, AuditDate, Details,
	d.ManCoDocID, d.IndexDefinitionID, d.QueueName,
	u.UserName, u.FirstName, u.LastName
	FROM MediaDefinitionAudits [a]
	INNER JOIN dbo.MediaDefinition [d] ON a.MediaDefinitionId = d.MediaDefID
	INNER JOIN dbo.AspNetUsers [u] ON a.UserId = u.Id
	WHERE a.MediaDefinitionId = @MediaDefinitionId
END